Skip to Content

Architecture & Components

This document describes the current architecture of the PlayServ Unity SDK.


Public API surface

The main entry point is the static PlayServ facade (Playserv.Wrapper.PlayServ).

Key operations are:

  • PlayServ.Config(...) - provide runtime settings.
  • PlayServ.Connect() / PlayServ.Disconnect() - open or close transport session.
  • PlayServ.Subscribe<T>(...) and PlayServ.Publish(...) - event messaging.
  • PlayServ.Invoke(...) - RPC command invocation.
  • PlayServ.SelectEntity<TEntity, TDto>(...) - data subscription and mutation.

Runtime components

The SDK runtime is split into modules:

  • Proxy - websocket transport, handshake, keepalive, reconnection.
  • Events - typed publish/subscribe over transport.
  • RPC - invoke request building and optional local invocation.
  • DataSubscription - live entity sync with patch updates.
  • Spawn - runtime spawn helpers (Unity-only scenarios).

Server and in-process mode

The same API can run without websocket transport by registering local handlers:

  • PlayServ.SetCommandHandler(ICommandHandler)
  • PlayServ.SetEventHandler(IEventHandler)
  • PlayServ.SetRpcInvoker(IRpcInvoker)

Built-in helpers:

  • LocalCommandHandler
  • LocalEventHandler
  • LocalRpcInvoker

In this mode, calls are handled in-process first. If a local handler does not handle a call and transport is connected, the SDK falls back to transport.


Extension model

Extension in the current SDK is handler-based:

  • add module routes in LocalCommandHandler
  • add event routing/subscription in IEventHandler
  • add service methods in IRpcInvoker

This keeps gameplay/domain code separate from transport plumbing.


Summary

PlayServ SDK architecture is a single public facade over transport, events, RPC, and live data sync, with optional local server-mode handlers for in-process execution.

Last updated on